<?php

class Edition extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'edition':
	 * @var integer $id
	 * @var string $libelle
	 * @var string $description
	 * @var string $type
	 * @var string $parameters
	 * @var string $filename
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'edition';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('libelle, type, filename', 'required'),
			array('libelle, filename', 'length', 'max'=>255),
			array('type', 'length', 'max'=>7),
			array('description, parameters', 'safe'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'edition_printeds' => array(self::HAS_MANY, 'EditionPrinted', 'edition_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'libelle' => 'Libelle',
			'description' => 'Description',
			'type' => 'Type',
			'parameters' => 'Parameters',
			'filename' => 'Filename',
		);
	}
}